package com.ssd.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ssd.contract.VendoutResp;
import com.ssd.entity.OrderEntity;
import com.ssd.entity.OrderStatusResponse;
import com.ssd.view.BaseResponse;
import com.ssd.viewmodel.OrderDetailViewModel;
import com.ssd.viewmodel.OrderViewModel;
import com.ssd.viewmodel.Pager;
import com.ssd.vo.CancelOrderVO;
import com.ssd.vo.SkuInfoVO;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

public interface OrderService extends IService<OrderEntity> {

    /**
     * 处理出货结果
     * @param vendoutResp 出货请求参数
     * @return
     */
    boolean vendoutResult(VendoutResp vendoutResp);


    /**
     * 修改订单状态
     * @param orderEntity
     * @return
     */
    BaseResponse changeStatus(OrderEntity orderEntity);

    /**
     * 通过订单编号获取订单实体
     * @param orderId
     * @return
     */
    OrderViewModel getByOrderNo(String orderId);

    public OrderViewModel getByOrderNoA(String orderId);


    OrderStatusResponse getStatusByOrderNo(String orderNo);

    public List<com.ssd.api.order.dto.OrderDetailViewModel> getListByOrderNo(String orderId);

    /**
     * 通过支付编号获取订单实体
     * @param transactionId
     * @return
     */
    String getByTransactionId(String transactionId);


    /**
     * 取消订单
     * @param cancelOrderVO
     * @return
     */
    BaseResponse cancel(CancelOrderVO cancelOrderVO);


    /**
     * 查询用户订单
     * @param pageIndex
     * @param pageSize
     * @param openId
     * @return
     */
    List<OrderViewModel> getListByOpenId(Integer pageIndex, Integer pageSize, String openId);

    /**
     * 订单搜索
     * @param pageIndex
     * @param pageSize
     * @param orderNo
     * @param start
     * @param end
     * @return
     */
    Pager<OrderEntity> search(Integer pageIndex, Integer pageSize, String orderNo, LocalDate start, LocalDate end);


    /**
     * 获取商圈下销量最好的10个商品
     * @param businessId
     * @return
     */
    List<Long> getTop10Sku( Integer businessId );



    /**
     * 获取一定时间范围之内的金额
     * @param partnerId
     * @param start
     * @param end
     * @return
     */
    Long getAmount(Integer partnerId, String innerCode,LocalDateTime start, LocalDateTime end);

    /**
     * 生成订单
     * @param openId
     * @param innerCode
     * @param amount
     * @return
     */
    Long createOrder(String openId,String innerCode,Integer amount,String productOrderNo,String addr);

    /**
     * 计算订单总金额
     * @param skuList
     * @return
     */
    Integer computeAmount(List<SkuInfoVO> skuList);

}
